<script setup>
  let msg = "hello vue3"
  let getMeg = () => {
    return "hello vue3 message"
  }
  let age = 15
  let bee = "蜂 蜜"

  // 购物车
  let carts = [{name:"可乐", "price":3, number:10}, {name:"薯片", "price":5, number:4}]
  // 计算购物车的总金额
  function compute() {
    let count = 0
    for(let index in carts){
      count += carts[index].price * carts[index].number
    }
    return count
  }
</script>

<template>
  <div>
    <h1>{{ msg }}</h1>
    message的值为：{{ msg }}<br>
    getMeg的返回值为：{{ getMeg() }}<br>
    是否成年：{{ age > 18 ? "是" : "否" }}<br>
    反转：{{ bee.split(" ").reverse().join("") }}<br>
    购物车中金额：{{ compute() }}<br>
    购物车中金额：{{ carts[0].price * carts[0].number + carts[1].price * carts[1].number}}<br>

  </div>
</template>
  

<style scoped>

</style>
